﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Shrestha.Trigraph.Graph;

namespace Shrestha.Trigraph
{
    public class WorkingSet : IComparable<WorkingSet>
    {
        public object EField { get; set; }
        
        public bool IsClustered { get; set; }
        public int ClusterId { get; set; }
        public bool ShowLocationLines {get;set;}
        
        public double MinDbLng { get; set; }
        public double MaxDbLng { get; set; }
        public double MinDbLat { get; set; }
        public double MaxDbLat { get; set; }
        public DateTime MinDbDate { get; set; }
        public DateTime MaxDbDate { get; set; }
        
        public int TotalRows{get;set;}

        private List<TriEvent> triEventList;
        public List<TriEvent> TriEventList
        {
            get { return triEventList; }
            set { triEventList = value; }
        }

        private List<TriClusterEvent> triClusterEventList;
        public List<TriClusterEvent> TriClusterEventList
        {
            get { return triClusterEventList; }
            set { triClusterEventList = value; }
        }

        public void AddEvent(TriEvent te)
        {
            triEventList.Add(te);
        }

        public void AddClusteredEvent(TriClusterEvent te)
        {
            triClusterEventList.Add(te);
        }

        public void AddEvent(double latitude, double longitude, DateTime date)
        {
            triEventList.Add(new TriEvent(latitude, longitude, date));
        }

        public void AddClusterEvent(double maxLat, double minLat, double maxLng, double minLng, DateTime maxDate, DateTime minDate, int clid)
        {
            triClusterEventList.Add(new TriClusterEvent(maxLat, minLat, maxLng, minLng, maxDate, minDate, clid));
        }

        public int CompareTo(WorkingSet other)
        {
            if (other.MinDbLat == this.MinDbLat &&
                other.MinDbLng == this.MinDbLng &&
                other.MaxDbLat == this.MaxDbLat &&
                other.MaxDbLng == this.MaxDbLng &&
                other.MinDbDate == this.MinDbDate &&
                other.MaxDbDate == this.MaxDbDate)
                return 0;
            else return 1;
        }
    }
}
